﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Work.Weixin
{
    public static class Utility
    {
        /// <summary>
        /// 获取指定<paramref name="time"/>的Unix时间戳。
        /// 
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        public static long ToUnixTimestamp(this DateTime time)
        {
            var epoch = (time.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
            return epoch;
        }
    }
}
